package protocol

import (
	"ezcloud/gw/internal/conf"
	"net"
)

type ProtoType string

const (
	HTTP ProtoType = "http"
)

type Protocol interface {
	Start(l net.Listener) error
	Stop() error
}

func NewProtocol(c conf.ProtocolConfig) Protocol {
	t := ProtoType(c.Type)
	switch t {
	case HTTP:
		return NewHttpProtocol(c)
	}
	return nil
}
